


class Solution:

    def rotate(self, nums:list, k: int):

        n = len(nums)
        k = k % n

        if n == 1:

            return
        
        temp = nums[n - k: n]

        # print(temp)
        nums[k: n] = nums[0: n - k]
        nums[0: k] = temp


if __name__ == "__main__":
    nums = [1,2,3,4,5,6,7]
    k = 3

    sol = Solution()
    sol.rotate(nums, k)
    print(nums)

